<template>
  <div class="bottom">
    <div
      class="tubiao"
      v-for="(item, index) in imge"
      :key="index"
      @click="fun(item, index)"
    >
      <!-- <div class="hezi" :style="block==index? {backgroundImage:`url(${item.url_in})`} :{backgroundImage:`url(${item.url})`}"> -->
      <div class="hezi">
        <img :src="item.url" alt="" v-show="block == index ? false : true" />
        <img :src="item.url_in" alt="" v-show="ino == index ? true : false" />
      </div>
      <div class="shang">
        <p>{{ item.name }}</p>
      </div>
    </div>
  </div>
</template>

<!-- <script>
export default {
  name: "bottom-i",
};
</script> -->

<script setup>
import { reactive, ref } from "vue";
import router from "@/router";

const imge = reactive([
  {
    url: require("../../imgytt/zhuye.png"),
    url_in: require("../../imgytt/zhuye_in.png"),
    name: "主页",
    path: "souye",
  },
  {
    url: require("../../imgytt/shequ.png"),
    url_in: require("../../imgytt/shequ_in.png"),
    name: "社区",
    path: "shequ",
  },
  {
    url: require("../../imgytt/shangchang.png"),
    url_in: require("../../imgytt/shangchang_in.png"),
    name: "商场",
    path: "mall",
  },
  {
    url: require("../../imgytt/xinxi.png"),
    url_in: require("../../imgytt/xinxi_in.png"),
    name: "消息",
    path: "xinxi",
  },
  {
    url: require("../../imgytt/mine.png"),
    url_in: require("../../imgytt/mine_in.png"),
    name: "我的",
    path: "myhome",
  },
]);
let ino = ref(0);
let block = ref(0);
console.log('---',ino.value,block.value);
function fun(item, index) {
  console.log(index+'index');
  ino.value = index;
  block.value = index;
   router.push({
    path: `${item.path}`,
  });
}
</script>

<style lang="less" scoped>
.bottom {
  position: fixed;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  width: 25.9375rem;
  height: 4.3125rem;
  margin: auto;
  background-color: #ffffff;
  padding: 0.3125rem 0;
  .tubiao {
    text-align: center;
    cursor: pointer;
    // .hezi {
    //   position: relative;
    //   width: 3.0625rem;
    //   height: 3.0625rem;
    //   // border-radius: 1.5625rem;
    //   // border: 1px solid black;
    //           left: 0;
    //     text-align: center;
    //     background-repeat: no-repeat;
    //     background-size: cover;
    //     background-position:center ;
    //     transform: scale(0.6);
    //   }
    .hezi {
      position: relative;
      width: 3.0625rem;
      height: 3.0625rem;
      // border-radius: 1.5625rem;
      // border: 1px solid black;
      img {
        position: absolute;
        left: 0;
        width: 3.0625rem;
        height: 3.0625rem;
        transform: scale(0.6);
      }
    }
  }
  .shang {
    margin-top: 0.3125rem;
    font-size: 0.75rem;
    color: #000000;
    font-weight: bold;
    font-family: "Ping Fang  SC  Bold";
  }
}
</style>